#pragma once
#include <vector>
#include "../Components/Transform.h"
#include "../Components/Materials/Material.h"
#include "../BaseDataStructures/Vertex.h"
#include <d3d11.h>
#include <d3dcommon.h>
#include <string>
class GameObject
{
protected:
	bool m_needToUpdateRenderingBuffer;
	bool m_needToUpdateTexture;
	bool m_isVisible;
	int m_shaderType;//1:material, 2:texture
	std::string m_name;
	std::string m_ambientTextureFileName;
	std::string m_diffuseTextureFileName;
	std::string m_specularTextureFileName;
	ID3D11Buffer* m_vertexBuffer;
	ID3D11Buffer* m_indexBuffer;
	Material* m_material;
	std::vector<Vertex>m_vertexes;
	std::vector<std::vector<int>>m_surfaces;
public:
	Transform* m_transform;
	ID3D11Texture2D* m_ambientMapTexture;
	ID3D11Texture2D* m_diffuseMapTexture;
	ID3D11Texture2D* m_specularMapTexture;
	ID3D11ShaderResourceView* m_ambientMapShaderResourceView;
	ID3D11ShaderResourceView* m_diffuseMapShaderResourceView;
	ID3D11ShaderResourceView* m_specularMapShaderResourceView;
	GameObject(std::vector<float>_position,std::string _name);
	GameObject(std::vector<float>_position, std::vector<Vertex>_vertexes,std::vector<std::vector<int>>_surfaces,std::string _name);
	virtual ~GameObject();
	bool GetIsVisible();
	void SetIsVisible(bool _isVisible);
	void AddVertex(Vertex newVertex);
	void AddSurfaces(std::vector<std::vector<int>>newSurfaces);
	static GameObject* CreateCube(std::vector<float>_position, std::string _name);
	std::vector<Vertex> GetVertexes();
	std::vector<std::vector<int>> GetIndexes();
	ID3D11Buffer** GetVertexBuffer();
	ID3D11Buffer** GetIndexBuffer();
	void SetVertexBuffer(ID3D11Buffer* vertexBuffer);
	void SetIndexBuffer(ID3D11Buffer* indexBuffer);
	int GetIndexNumber();
	Material* GetMaterial();
	void UseMaterial(Material* material);
	void UseTexture(std::string ambientMapFileName, std::string diffuseMapFileName, std::string specularMapFileName);//If not using some of the texture types, specify empty string.
	bool GetNeedToUpdateRenderingBuffer();
	void SetNeedToUpdateRenderingBuffer(bool status);
	bool GetNeedToUpdateTexture();
	void SetNeedToUpdateTexture(bool status);
	std::string GetAmbientTextureFileName();
	std::string GetDiffuseTextureFileName();
	std::string GetSpecularTextureFileName();
	int GetShaderType();
};